<template>
  <a-modal :title="$t('详情')" :visible="visible" @cancel="handleCancel" width="900px" class="modal_title" v-drag>
    <div class="wrapper">
      <a-row class="black-row">
        <a-col :span="24"><div class="top-row" style="font-weight:600">{{ $t('转出会员') }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('业务时间') }}：{{ transOut.createTime }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('业务类型') }}：{{ transOut.typeId_dictText }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('卡号') }}：{{ transOut.chipNo }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('手机号') }}：{{ transOut.phone }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('会员姓名') }}：{{ transOut.name }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('业务渠道') }}：{{ transOut.deviceType_dictText }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('设备') }}：{{ transOut.deviceId?(transOut.deviceId_dictText+'('+ transOut.deviceId +')'):'' }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('操作员') }}：{{ transOut.createBy }}</div></a-col>
        <a-col :span="12" v-if="(transOut.realCoinValue + transOut.presentCoinValue) != 0"><div class="top-row">{{ $t('交易前币') }}：{{ (transOut.realCoinBefore + transOut.presentCoinBefore).toFixed(2) }}</div></a-col>
        <a-col :span="12" v-if="(transOut.realCoinValue + transOut.presentCoinValue) != 0"><div class="top-row">{{ $t('交易币') }}：<span style="font-weight:600;color:#333">{{ (transOut.realCoinValue + transOut.presentCoinValue).toFixed(2) }}</span></div></a-col>
        <a-col :span="12" v-if="(transOut.realCoinValue + transOut.presentCoinValue) != 0"><div class="top-row">{{ $t('交易后币') }}：{{ (transOut.realCoinAfter + transOut.presentCoinAfter).toFixed(2) }}</div></a-col>
        <a-col :span="12" v-if="transOut.lotteryValue != 0"><div class="top-row">{{ $t('交易前彩票') }}：{{ transOut.lotteryBefore.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transOut.lotteryValue != 0"><div class="top-row">{{ $t('交易彩票') }}：<span style="font-weight:600;color:#333">{{ transOut.lotteryValue.toFixed(0) }}</span></div></a-col>
        <a-col :span="12" v-if="transOut.lotteryValue != 0"><div class="top-row">{{ $t('交易后彩票') }}：{{ transOut.lotteryAfter.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transOut.integralValue != 0"><div class="top-row">{{ $t('交易前积分') }}：{{ transOut.integralBefore.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transOut.integralValue != 0"><div class="top-row">{{ $t('交易积分') }}：<span style="font-weight:600;color:#333">{{ transOut.integralValue.toFixed(0) }}</span></div></a-col>
        <a-col :span="12" v-if="transOut.integralValue != 0"><div class="top-row">{{ $t('交易后积分') }}：{{ transOut.integralAfter.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transOut.alotteryValue != 0"><div class="top-row">{{ $t('交易前A票') }}：{{ transOut.alotteryBefore.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transOut.alotteryValue != 0"><div class="top-row">{{ $t('交易A票') }}：<span style="font-weight:600;color:#333">{{ transOut.alotteryValue.toFixed(0) }}</span></div></a-col>
        <a-col :span="12" v-if="transOut.alotteryValue != 0"><div class="top-row">{{ $t('交易后A票') }}：{{ transOut.alotteryAfter.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transOut.pointsValue != 0"><div class="top-row">{{ $t('交易前A币') }}：{{ transOut.pointsBefore.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transOut.pointsValue != 0"><div class="top-row">{{ $t('交易A币') }}：<span style="font-weight:600;color:#333">{{ transOut.pointsValue.toFixed(0) }}</span></div></a-col>
        <a-col :span="12" v-if="transOut.pointsValue != 0"><div class="top-row">{{ $t('交易后A币') }}：{{ transOut.pointsAfter.toFixed(0) }}</div></a-col>
      </a-row>
      <a-row class="black-row">
        <a-col :span="24"><div class="top-row" style="font-weight:600">{{ $t('转入会员') }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('业务时间') }}：{{ transIn.createTime }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('业务类型') }}：{{ transIn.typeId_dictText }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('卡号') }}：{{ transIn.chipNo }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('手机号') }}：{{ transIn.phone }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('会员姓名') }}：{{ transIn.name }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('业务渠道') }}：{{ transIn.deviceType_dictText }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('设备') }}：{{ transIn.deviceId?(transIn.deviceId_dictText+'('+ transIn.deviceId +')'):'' }}</div></a-col>
        <a-col :span="12"><div class="top-row">{{ $t('操作员') }}：{{ transIn.createBy }}</div></a-col>
        <a-col :span="12" v-if="(transIn.realCoinValue + transIn.presentCoinValue) != 0"><div class="top-row">{{ $t('交易前币') }}：{{ (transIn.realCoinBefore + transIn.presentCoinBefore).toFixed(2) }}</div></a-col>
        <a-col :span="12" v-if="(transIn.realCoinValue + transIn.presentCoinValue) != 0"><div class="top-row">{{ $t('交易币') }}：<span style="font-weight:600;color:#333">{{ (transIn.realCoinValue + transIn.presentCoinValue).toFixed(2) }}</span></div></a-col>
        <a-col :span="12" v-if="(transIn.realCoinValue + transIn.presentCoinValue) != 0"><div class="top-row">{{ $t('交易后币') }}：{{ (transIn.realCoinAfter + transIn.presentCoinAfter).toFixed(2) }}</div></a-col>
        <a-col :span="12" v-if="transIn.lotteryValue != 0"><div class="top-row">{{ $t('交易前彩票') }}：{{ transIn.lotteryBefore.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transIn.lotteryValue != 0"><div class="top-row">{{ $t('交易彩票') }}：<span style="font-weight:600;color:#333">{{ transIn.lotteryValue.toFixed(0) }}</span></div></a-col>
        <a-col :span="12" v-if="transIn.lotteryValue != 0"><div class="top-row">{{ $t('交易后彩票') }}：{{ transIn.lotteryAfter.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transIn.integralValue != 0"><div class="top-row">{{ $t('交易前积分') }}：{{ transIn.integralBefore.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transIn.integralValue != 0"><div class="top-row">{{ $t('交易积分') }}：<span style="font-weight:600;color:#333">{{ transIn.integralValue.toFixed(0) }}</span></div></a-col>
        <a-col :span="12" v-if="transIn.integralValue != 0"><div class="top-row">{{ $t('交易后积分') }}：{{ transIn.integralAfter.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transIn.alotteryValue != 0"><div class="top-row">{{ $t('交易前A票') }}：{{ transIn.alotteryBefore.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transIn.alotteryValue != 0"><div class="top-row">{{ $t('交易A票') }}：<span style="font-weight:600;color:#333">{{ transIn.alotteryValue.toFixed(0) }}</span></div></a-col>
        <a-col :span="12" v-if="transIn.alotteryValue != 0"><div class="top-row">{{ $t('交易后A票') }}：{{ transIn.alotteryAfter.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transIn.pointsValue != 0"><div class="top-row">{{ $t('交易前A币') }}：{{ transIn.pointsBefore.toFixed(0) }}</div></a-col>
        <a-col :span="12" v-if="transIn.pointsValue != 0"><div class="top-row">{{ $t('交易A币') }}：<span style="font-weight:600;color:#333">{{ transIn.pointsValue.toFixed(0) }}</span></div></a-col>
        <a-col :span="12" v-if="transIn.pointsValue != 0"><div class="top-row">{{ $t('交易后A币') }}：{{ transIn.pointsAfter.toFixed(0) }}</div></a-col>
      </a-row>
    </div>

    <template slot="footer">
      <a-button @click="handleCancel">{{ $t('关闭') }}</a-button>
    </template>
  </a-modal>
</template>

<script>
import { getAction } from '@/api/manage'
let transType
export default {
  name: 'MemberSharedtlModal',
  components: {},
  data() {
    return {
      visible: false,
      transIn: {},
      transOut: {},
    }
  },
  mounted() {},
  methods: {
    getInfo(id) {
      return new Promise((resolve) => {
        getAction('/member/bisMemberAccountChange/list', { id: id }).then((res) => {
          if (res.success) {
            if (transType == 'in') {
              this.transOut = Object.assign({}, res.result.records[0])
            } else {
              this.transIn = Object.assign({}, res.result.records[0])
            }
          } else {
            this.$message.error(res.message)
          }
          resolve()
        })
      })
    },
    async show(record) {
      if (record.comment != undefined) {
        transType = 'in'
        this.transIn = Object.assign({}, record)
      } else {
        transType = 'out'
        this.transOut = Object.assign({}, record)
      }
      await this.getInfo(record.subChangeId)
      this.visible = true
    },
    handleCancel() {
      this.visible = false
    },
  },
}
</script>
<style>
.black-row {
  margin: 10px 15px;
  border: 1px solid #d9d9d9;
  padding: 10px;
  border-radius: 5px;
  font-size: 15px;
}
</style>